Fix T47064: Change Audio defaults to 48 kHz

Historically blender had an audio sample rate of 44.1 kHz as default which is mostly popular because it's the sample rate of audio CDs. Audaspace kept using this default from the pre 2.5 era. It was about time to change to 48 kHz, which is a more widespread standard nowadays, especially in video. It is the recommended sampling rate of the Audio Engineering Society.

Further reading: https://en.wikipedia.org/wiki/44,100_Hz#Status
This commit is contained in:
Joerg Mueller 2015-12-27 16:33:54 +01:00
parent 0a118317fc
commit fcc68a02e9
Notes: blender-bot 2023-02-14 08:20:39 +01:00
Referenced by issue #47064, Change Audio defaults to 48000hz
12 changed files with 20 additions and 15 deletions

View File

@ -128,7 +128,7 @@ Factory_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
}
PyDoc_STRVAR(M_aud_Factory_sine_doc,
"sine(frequency, rate=44100)\n\n"
"sine(frequency, rate=48000)\n\n"
"Creates a sine factory which plays a sine wave.\n\n"
":arg frequency: The frequency of the sine wave in Hz.\n"
":type frequency: float\n"
@ -142,7 +142,7 @@ static PyObject *
Factory_sine(PyTypeObject* type, PyObject *args)
{
float frequency;
double rate = 44100;
double rate = 48000;
if(!PyArg_ParseTuple(args, "f|d:sine", &frequency, &rate))
return NULL;
@ -2115,7 +2115,7 @@ Device_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
static const char *kwlist[] = {"type", "rate", "channels", "format", "buffer_size", "name", NULL};
int device;
double rate = AUD_RATE_44100;
double rate = AUD_RATE_48000;
int channels = AUD_CHANNELS_STEREO;
int format = AUD_FORMAT_FLOAT32;
int buffersize = AUD_DEFAULT_BUFFER_SIZE;

View File

@ -48,7 +48,7 @@ AUD_SDLDevice::AUD_SDLDevice(AUD_DeviceSpecs specs, int buffersize)
if(specs.format == AUD_FORMAT_INVALID)
specs.format = AUD_FORMAT_S16;
if(specs.rate == AUD_RATE_INVALID)
specs.rate = AUD_RATE_44100;
specs.rate = AUD_RATE_48000;
m_specs = specs;

View File

@ -918,7 +918,7 @@ AUD_Sound *AUD_Sequence_create(float fps, int muted)
// specs are changed at a later point!
AUD_Specs specs;
specs.channels = AUD_CHANNELS_STEREO;
specs.rate = AUD_RATE_44100;
specs.rate = AUD_RATE_48000;
AUD_Sound *sequencer = new AUD_Sound(boost::shared_ptr<AUD_SequencerFactory>(new AUD_SequencerFactory(specs, fps, muted)));
return sequencer;
}

View File

@ -59,7 +59,7 @@ int AUD_SilenceReader::getPosition() const
AUD_Specs AUD_SilenceReader::getSpecs() const
{
AUD_Specs specs;
specs.rate = AUD_RATE_44100;
specs.rate = AUD_RATE_48000;
specs.channels = AUD_CHANNELS_MONO;
return specs;
}

View File

@ -59,7 +59,7 @@ public:
* \param sampleRate The target sample rate for playback.
*/
AUD_SinusFactory(float frequency,
AUD_SampleRate sampleRate = AUD_RATE_44100);
AUD_SampleRate sampleRate = AUD_RATE_48000);
/**
* Returns the frequency of the sine wave.

View File

@ -50,9 +50,9 @@
/// Returns the bigger of the two values.
#define AUD_MAX(a, b) (((a) > (b)) ? (a) : (b))
// 5 sec * 44100 samples/sec * 4 bytes/sample * 6 channels
// 5 sec * 48000 samples/sec * 4 bytes/sample * 6 channels
/// The size by which a buffer should be resized if the final extent is unknown.
#define AUD_BUFFER_RESIZE_BYTES 5292000
#define AUD_BUFFER_RESIZE_BYTES 5760000
/// The default playback buffer size of a device.
#define AUD_DEFAULT_BUFFER_SIZE 1024

View File

@ -651,7 +651,7 @@ void BKE_scene_init(Scene *sce)
}
pset->brush[PE_BRUSH_CUT].strength = 100;
sce->r.ffcodecdata.audio_mixrate = 44100;
sce->r.ffcodecdata.audio_mixrate = 48000;
sce->r.ffcodecdata.audio_volume = 1.0f;
sce->r.ffcodecdata.audio_bitrate = 192;
sce->r.ffcodecdata.audio_channels = 2;

View File

@ -227,7 +227,7 @@ void BKE_sound_init(struct Main *bmain)
buffersize = 1024;
if (specs.rate < AUD_RATE_8000)
specs.rate = AUD_RATE_44100;
specs.rate = AUD_RATE_48000;
if (specs.format <= AUD_FORMAT_INVALID)
specs.format = AUD_FORMAT_S16;

View File

@ -60,6 +60,9 @@ void BLO_update_defaults_userpref_blend(void)
U.versions = 1;
U.savetime = 2;
/* default from T47064 */
U.audiorate = 48000;
}
/**
@ -140,6 +143,8 @@ void BLO_update_defaults_startup_blend(Main *bmain)
scene->gm.lodflag |= SCE_LOD_USE_HYST;
scene->gm.scehysteresis = 10;
scene->r.ffcodecdata.audio_mixrate = 48000;
}
for (linestyle = bmain->linestyle.first; linestyle; linestyle = linestyle->id.next) {

View File

@ -1418,7 +1418,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main)
}
for (sce = main->scene.first; sce; sce = sce->id.next) {
sce->audio.mixrate = 44100;
sce->audio.mixrate = 48000;
sce->audio.flag |= AUDIO_SCRUB;
sce->r.mode |= R_ENVMAP;
}
@ -2219,7 +2219,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main)
}
for (sce = main->scene.first; sce; sce = sce->id.next) {
if (sce->audio.mixrate == 0)
sce->audio.mixrate = 44100;
sce->audio.mixrate = 48000;
if (sce->r.xparts <2 )
sce->r.xparts = 4;

View File

@ -1940,7 +1940,7 @@ void init_userdef_do_versions(void)
if (U.audioformat == 0)
U.audioformat = 0x24;
if (U.audiorate == 0)
U.audiorate = 44100;
U.audiorate = 48000;
}
if (!USER_VERSION_ATLEAST(250, 8)) {

View File

@ -1571,7 +1571,7 @@ void WM_main_playanim(int argc, const char **argv)
{
AUD_DeviceSpecs specs;
specs.rate = AUD_RATE_44100;
specs.rate = AUD_RATE_48000;
specs.format = AUD_FORMAT_S16;
specs.channels = AUD_CHANNELS_STEREO;