Class: Seal::Reverb

Inherits:
Object
  • Object
show all
Defined in:
src/rubyext.c,
src/rubyext.c

Overview

Interfaces for manipulating reverberation effect objects which can be loaded into effect slots. The reverberation parameters can be customized to emulate reverberations in different environment or can be loaded from presets. The preset constants suggest the reverberation environment, for example, Reverb::Preset::IcePalace::LONGPASSAGE emulates the reverberation in a long passage of an ice palace.

For more infomation about reverberations, check out the OpenAL effect extension guide at: zhang.su/seal/EffectsExtensionGuide.pdf

Defined Under Namespace

Modules: Preset

Instance Method Summary (collapse)

Constructor Details

- (Object) Seal::Reverb.new - (Object) Seal::Reverb.new(preset)

Initializes a new reverb effect. If a preset is specified, initializes the reverb object to load the preset.

There is a limit on the number of allocated reverbs. This method raises an error if it is exceeding the limit.



1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
# File 'src/rubyext.c', line 1127

static
VALUE
init_rvb(int argc, VALUE* argv, VALUE rrvb)
{
    seal_rvb_t* rvb;
    VALUE rpreset;

    rvb = DATA_PTR(rrvb);
    check_seal_err(seal_init_rvb(rvb));

    rb_scan_args(argc, argv, "01", &rpreset);
    if (!NIL_P(rpreset))
        load_rvb(rrvb, rpreset);

    return rrvb;
}

Instance Method Details

- (Object) air_absorbtion_hfgain

Gets the air absorbtion high-frequency gain of reverb. The default is 0.994.



1484
1485
1486
1487
1488
1489
# File 'src/rubyext.c', line 1484

static
VALUE
get_rvb_air_absorbtion_hfgain(VALUE rrvb)
{
    return get_obj_float(rrvb, seal_get_rvb_air_absorbtion_hfgain);
}

- (Object) air_absorbtion_hfgain=(flt)

Sets the air absorption high-frequency gain of reverb in the interval [0.892, 1.0]. It controls the distance-dependent attenuation at high frequencies caused by the propagation medium. It applies to reflected sound only. You can use this value to simulate sound transmission through foggy air, dry air, smoky atmosphere, and so on. The default value 0.994 (-0.05 dB) per meter, which roughly corresponds to typical condition of atmospheric humidity, temperature, and so on. Lowering the value simulates a more absorbent medium (more humidity in the air, for example); raising the value simulates a less absorbent medium (dry desert air, for example).



1470
1471
1472
1473
1474
1475
# File 'src/rubyext.c', line 1470

static
VALUE
set_rvb_air_absorbtion_hfgain(VALUE rrvb, VALUE value)
{
    return set_obj_float(rrvb, value, seal_set_rvb_air_absorbtion_hfgain);
}

- (Object) decay_time

Gets the decay time of reverb. The default is 1.49.



1285
1286
1287
1288
1289
1290
# File 'src/rubyext.c', line 1285

static
VALUE
get_rvb_decay_time(VALUE rrvb)
{
    return get_obj_float(rrvb, seal_get_rvb_decay_time);
}

- (Object) decay_time=(flt)

Sets the decay time of reverb in the interval [0.1, 20.0], typically from a small room with very dead surfaces to a large room with very live surfaces.



1272
1273
1274
1275
1276
1277
# File 'src/rubyext.c', line 1272

static
VALUE
set_rvb_decay_time(VALUE rrvb, VALUE value)
{
    return set_obj_float(rrvb, value, seal_set_rvb_decay_time);
}

- (Object) density

Gets the density of reverb. The default is 1.0.



1165
1166
1167
1168
1169
1170
# File 'src/rubyext.c', line 1165

static
VALUE
get_rvb_density(VALUE rrvb)
{
    return get_obj_float(rrvb, seal_get_rvb_density);
}

- (Object) density=(flt)

Sets the modal density of reverb in the interval [0.0, 1.0]. The density controls the coloration of the late reverb. The Lower the value, the more coloration.



1152
1153
1154
1155
1156
1157
# File 'src/rubyext.c', line 1152

static
VALUE
set_rvb_density(VALUE rrvb, VALUE value)
{
    return set_obj_float(rrvb, value, seal_set_rvb_density);
}

- (Object) diffusion

Gets the diffusion of reverb. The default is 1.0.



1195
1196
1197
1198
1199
1200
# File 'src/rubyext.c', line 1195

static
VALUE
get_rvb_diffusion(VALUE rrvb)
{
    return get_obj_float(rrvb, seal_get_rvb_diffusion);
}

- (Object) diffusion=(flt)

Sets the diffusion of reverb in the interval [0.0, 1.0]. The diffusion controls the echo density in the reverberation decay. Reducing diffusion gives the reverberation a more “grainy” character that is especially noticeable with percussive sound sources. If you set a diffusion value of 0.0, the later reverberation sounds like a succession of distinct echoes.



1182
1183
1184
1185
1186
1187
# File 'src/rubyext.c', line 1182

static
VALUE
set_rvb_diffusion(VALUE rrvb, VALUE value)
{
    return set_obj_float(rrvb, value, seal_set_rvb_diffusion);
}

- (Object) gain

Gets the gain of reverb. The default is 0.32.



1226
1227
1228
1229
1230
1231
# File 'src/rubyext.c', line 1226

static
VALUE
get_rvb_gain(VALUE rrvb)
{
    return get_obj_float(rrvb, seal_get_rvb_gain);
}

- (Object) gain=(flt)

Sets the gain of reverb in the interval [0.0, 1.0], or from -100 dB (no reflected sound at all) to 0 dB (the maximum amount). The gain is the master volume control for the reflected sound (both early reflections and reverberation) that the reverb effect adds to all sources. It sets the maximum amount of reflections and reverberation added to the final sound mix.



1213
1214
1215
1216
1217
1218
# File 'src/rubyext.c', line 1213

static
VALUE
set_rvb_gain(VALUE rrvb, VALUE value)
{
    return set_obj_float(rrvb, value, seal_set_rvb_gain);
}

- (Boolean) hfdecay_limited Also known as: hfdecay_limited?

Determines if the high-frequency decay of reverb is limited. The default is true.

Returns:

  • (Boolean)


1565
1566
1567
1568
1569
1570
# File 'src/rubyext.c', line 1565

static
VALUE
is_rvb_hfdecay_limited(VALUE rrvb)
{
    return get_obj_char(rrvb, seal_is_rvb_hfdecay_limited);
}

- (Boolean) hfdecay_limited=(true)

Sets whether the high-frequency decay time automatically stays below a limit value that's derived from the setting of the air absorption high- frequency gain. This limit applies regardless of the setting of the decay high-frequency ratio, and the limit doesn't affect the value of decay high-frequency ratio. This limit, when on, maintains a natural sounding reverberation decay by allowing you to increase the value of decay time without the risk of getting an unnaturally long decay time at high frequencies. If this flag is set to false, high-frequency decay time isn't automatically limited.

Returns:

  • (Boolean)


1551
1552
1553
1554
1555
1556
# File 'src/rubyext.c', line 1551

static
VALUE
set_rvb_hfdecay_limited(VALUE rrvb, VALUE value)
{
    return set_obj_char(rrvb, value, seal_set_rvb_hfdecay_limited);
}

- (Object) hfdecay_ratio

Gets the high-frequency decay ratio of reverb. The default is 0.83.



1320
1321
1322
1323
1324
1325
# File 'src/rubyext.c', line 1320

static
VALUE
get_rvb_hfdecay_ratio(VALUE rrvb)
{
    return get_obj_float(rrvb, seal_get_rvb_hfdecay_ratio);
}

- (Object) hfdecay_ratio=(flt)

Sets the high-frequency decay ratio, or the spectral quality of the decay time of reverb in the interval [0.1, 2.0]. It is the ratio of high-frequency decay time relative to the time set by decay Time. 1.0 means neutral: the decay time is equal for all frequencies. As this value increases above 1.0, the high-frequency decay time increases so it's longer than the decay time at low frequencies. You hear a more brilliant reverberation with a longer decay at high frequencies. As this value decreases below 1.0, the high-frequency decay time decreases so it's shorter than the decay time of the low frequencies. You hear a more natural reverberation.



1307
1308
1309
1310
1311
1312
# File 'src/rubyext.c', line 1307

static
VALUE
set_rvb_hfdecay_ratio(VALUE rrvb, VALUE value)
{
    return set_obj_float(rrvb, value, seal_set_rvb_hfdecay_ratio);
}

- (Object) hfgain

Gets the high-frequency gain of reverb. The default is 0.89.



1257
1258
1259
1260
1261
1262
# File 'src/rubyext.c', line 1257

static
VALUE
get_rvb_hfgain(VALUE rrvb)
{
    return get_obj_float(rrvb, seal_get_rvb_hfgain);
}

- (Object) hfgain=(flt)

Sets the high-frequency gain of reverb in the interval [0.0, 1.0], or from -100 dB (virtually no reflected sound) to 0 dB (no filter). The high- frequency gain further tweaks reflected sound by attenuating it at high frequencies. It controls a low-pass filter that applies globally to the reflected sound of all sound sources feeding the particular instance of the reverb effect.



1244
1245
1246
1247
1248
1249
# File 'src/rubyext.c', line 1244

static
VALUE
set_rvb_hfgain(VALUE rrvb, VALUE value)
{
    return set_obj_float(rrvb, value, seal_set_rvb_hfgain);
}

- (Object) late_delay

Gets the late delay of reverb. The default is 0.011.



1450
1451
1452
1453
1454
1455
# File 'src/rubyext.c', line 1450

static
VALUE
get_rvb_late_delay(VALUE rrvb)
{
    return get_obj_float(rrvb, seal_get_rvb_late_delay);
}

- (Object) late_delay=(flt)

Sets the late delay of reverb in the interval [0.0, 0.1] (in second) It defines the begin time of the late reverberation relative to the time of the initial reflection (the first of the early reflections). Reducing or increasing late delay is useful for simulating a smaller or larger room.



1437
1438
1439
1440
1441
1442
# File 'src/rubyext.c', line 1437

static
VALUE
set_rvb_late_delay(VALUE rrvb, VALUE value)
{
    return set_obj_float(rrvb, value, seal_set_rvb_late_delay);
}

- (Object) late_gain

Gets the late gain of reverb. The default is 1.26.



1421
1422
1423
1424
1425
1426
# File 'src/rubyext.c', line 1421

static
VALUE
get_rvb_late_gain(VALUE rrvb)
{
    return get_obj_float(rrvb, seal_get_rvb_late_gain);
}

- (Object) late_gain=(flt)

Sets the late gain, or the overall amount of later reverberation relative to the gain of reverb in the interval [0.0, 10.0], or from -100 dB (no late reverberation at all) to 20 dB.

Note that late gain and decay time are independent properties: if you adjust decay time without changing late gain, the total intensity (the averaged square of the amplitude) of the late reverberation remains constant.



1408
1409
1410
1411
1412
1413
# File 'src/rubyext.c', line 1408

static
VALUE
set_rvb_late_gain(VALUE rrvb, VALUE value)
{
    return set_obj_float(rrvb, value, seal_set_rvb_late_gain);
}

- (Object) load(preset)

Loads the specified reverb paramter preset into reverb.



1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
# File 'src/rubyext.c', line 1104

static
VALUE
load_rvb(VALUE rrvb, VALUE rpreset)
{
    seal_rvb_t* rvb;

    Data_Get_Struct(rrvb, seal_rvb_t, rvb);
    check_seal_err(seal_load_rvb(rvb, NUM2INT(rpreset)));

    return rrvb;
}

- (Object) reflections_delay

Gets the reflections delay of reverb. The default is 0.007.



1388
1389
1390
1391
1392
1393
# File 'src/rubyext.c', line 1388

static
VALUE
get_rvb_reflections_delay(VALUE rrvb)
{
    return get_obj_float(rrvb, seal_get_rvb_reflections_delay);
}

- (Object) reflections_delay=(flt)

Sets the reflections delay of reverb in the interval [0.0, 0.3] (in seconds). It is the amount of delay between the arrival time of the direct path from the source to the first reflection from the source. You can reduce or increase this delay to simulate closer or more distant reflective surfaces and therefore control the perceived size of the room.



1375
1376
1377
1378
1379
1380
# File 'src/rubyext.c', line 1375

static
VALUE
set_rvb_reflections_delay(VALUE rrvb, VALUE value)
{
    return set_obj_float(rrvb, value, seal_set_rvb_reflections_delay);
}

- (Object) reflections_gain

Gets the reflections gain of reverb. The default is 0.05.



1358
1359
1360
1361
1362
1363
# File 'src/rubyext.c', line 1358

static
VALUE
get_rvb_reflections_gain(VALUE rrvb)
{
    return get_obj_float(rrvb, seal_get_rvb_reflections_gain);
}

- (Object) reflections_gain=(flt)

Sets the reflections gain, or the overall amount of initial reflections relative to the gain of reverb in the interval [0.0, 3.16], or from -100 dB (no initial reflections at all) to 10 dB. The reflections gain is corrected by the value of the gain property and does not affect the subsequent reverberation decay.

You can increase the amount of initial reflections to simulate a more narrow space or closer walls, especially effective if you associate the initial reflections increase with a reduction in reflections delays by lowering the value of the reflection delay property. To simulate open or semi-open environments, you can maintain the amount of early reflections while reducing the value of the late gain property, which controls later reflections.



1345
1346
1347
1348
1349
1350
# File 'src/rubyext.c', line 1345

static
VALUE
set_rvb_reflections_gain(VALUE rrvb, VALUE value)
{
    return set_obj_float(rrvb, value, seal_set_rvb_reflections_gain);
}

- (Object) room_rolloff_factor

Gets the room rolloff factor of reverb. The default is 0.0.



1530
1531
1532
1533
1534
1535
# File 'src/rubyext.c', line 1530

static
VALUE
get_rvb_room_rolloff_factor(VALUE rrvb)
{
    return get_obj_float(rrvb, seal_get_rvb_room_rolloff_factor);
}

- (Object) room_rolloff_factor=(flt)

Sets the room rolloff factor of reverb in the interval [0.0, 10.0]. It is one of two methods available to attenuate the reflected sound (containing both reflections and reverberation) according to source- listener distance. It is defined the same way as the global rolloff factor, but operates on reverb sound instead of direct-path sound. Setting the room rolloff factor value to 1.0 specifies that the reflected sound will decay by 6 dB every time the distance doubles. Any value other than 1.0 is equivalent to a scaling factor applied to the quantity specified by ((source listener distance) - (Reference Distance)). Reference Distance is an OpenAL source parameter that specifies the inner border for distance rolloff effects: if the source comes closer to the listener than the reference distance, the direct-path sound isn't increased as the source comes closer to the listener, and neither is the reflected sound.

The default value of Room Rolloff Factor is 0.0 because, by default, the reverb effect naturally manages the reflected sound level automatically for each sound source to simulate the natural rolloff of reflected sound vs. distance in typical rooms. (Note that this isn't the case if the source property @TODO is set to false.) You can use this value as an option to automatic control so you can exaggerate or replace the default automatically-controlled rolloff.



1517
1518
1519
1520
1521
1522
# File 'src/rubyext.c', line 1517

static
VALUE
set_rvb_room_rolloff_factor(VALUE rrvb, VALUE value)
{
    return set_obj_float(rrvb, value, seal_set_rvb_room_rolloff_factor);
}