mindboost-rnbo-test-project/tracks.config.ts

99 lines
5.2 KiB
TypeScript

/***
*
* In this tracks config file all the audio files paths are stored,
* to easily manage and adjust audio files paths for the whole application.
* It is used in the nuxt.config.ts file to be provided as runtimeConfig
*/
const tracksConfig = {
debug_src: '/sounds/debug/LMusik_RSprache.mp3',
masking_src: '/masking/fullband.wav',
masking_src_flac: '/masking/Quellrauschen mir Reverb loopbar_+10dB.flac',
masking_src_mp3: '/masking/Quellrauschen_loopbar_+10dB.mp3',
forest_src: '/sounds/48kHz_15min/MindMusik_15min_48KHz_Forest.mp3',
meadow_src: '/sounds/48kHz_15min/MindMusik_15min_48KHz_Meadow.mp3',
tropics_src: '/sounds/48kHz_15min/MindMusik_15min_48KHz_Tropics.mp3',
lagoon_src: '/sounds/48kHz_15min/MindMusik_15min_48KHz_Lagoon.mp3',
forest_48_mp3_src: '/sounds/48kHz_15min/MindMusik_15min_48KHz_Forest.mp3',
meadow_48_mp3_src: '/sounds/48kHz_15min/MindMusik_15min_48KHz_Meadow.mp3',
lagoon_48_mp3_src: '/sounds/48kHz_15min/MindMusik_15min_48KHz_Lagoon.mp3',
tropics_48_mp3_src: '/sounds/48kHz_15min/MindMusik_15min_48KHz_Tropics.mp3',
forest_48_flac_src: '/sounds/48kHz_15min/MindMusik_15min_48KHz_Forest.flac',
meadow_48_flac_src: '/sounds/48kHz_15min/MindMusik_15min_48KHz_Meadow.flac',
lagoon_48_flac_src: '/sounds/48kHz_15min/MindMusik_15min_48KHz_Lagoon.flac',
tropics_48_flac_src: '/sounds/48kHz_15min/MindMusik_15min_48KHz_Tropics.flac',
// Dateien aus dem Ordner "bands"
'63_src': '/masking/bands/Quellrauschen63.webm',
'125_src': '/masking/bands/Quellrauschen125.webm',
'250_src': '/masking/bands/Quellrauschen250.webm',
'500_src': '/masking/bands/Quellrauschen500.webm',
'1000_src': '/masking/bands/Quellrauschen1000.webm',
'2000_src': '/masking/bands/Quellrauschen2000.webm',
'4000_src': '/masking/bands/Quellrauschen4000.webm',
'8000_src': '/masking/bands/Quellrauschen8000.webm',
'16000_src': '/masking/bands/Quellrauschen16000.webm',
'63_src_wav': '/masking/bands/Quellrauschen63.wav',
'125_src_wav': '/masking/bands/Quellrauschen125.wav',
'250_src_wav': '/masking/bands/Quellrauschen250.wav',
'500_src_wav': '/masking/bands/Quellrauschen500.wav',
'1000_src_wav': '/masking/bands/Quellrauschen1000.wav',
'2000_src_wav': '/masking/bands/Quellrauschen2000.wav',
'4000_src_wav': '/masking/bands/Quellrauschen4000.wav',
'8000_src_wav': '/masking/bands/Quellrauschen8000.wav',
'16000_src_wav': '/masking/bands/Quellrauschen16000.wav',
}
export default tracksConfig
export function getSoundscapeByTitle(title: string): string | null {
switch (title) {
case 'Forest':
return tracksConfig.forest_48_mp3_src
case 'Tropics':
return tracksConfig.tropics_48_mp3_src
case 'Meadow':
return tracksConfig.meadow_48_mp3_src
case 'Lagoon':
return tracksConfig.lagoon_48_mp3_src
default:
return null
}
}
/** Solange wir nur vier Tracks haben, wird es noch nicht dynamsich aus dem Backend geladen, TBD für die Zukunft. */
export function getSoundcapeList(): string[] {
return ['Forest','Tropics','Meadow', 'Lagoon']
}
/***
This configuration file defines the audio tracks used in the Mindboost application. It's designed to provide a centralized location for managing audio file paths while considering potential browser and codec limitations. Here's an analysis of the current setup and recommendations for avoiding issues:
1.
M4A Avoidance: As noted in the comment, M4A files are not used due to playback issues in Chrome. This is a good practice to ensure cross-browser compatibility.
2.
MP3 Usage: The configuration includes MP3 files, which are widely supported across browsers. However, it's worth noting that MP3 is a lossy format, which may not be ideal for high-quality audio requirements.
3.
FLAC Inclusion: FLAC files are included, which is excellent for high-quality audio. However, FLAC support is not universal across all browsers, particularly older versions of Internet Explorer and some mobile browsers.
4.
Potential Issues to Consider:
a. WebM Audio: Consider including WebM audio files as an alternative. They offer good compression and are well-supported in modern browsers.
b. OGG Vorbis: Another option for high-quality, open-source audio that's well-supported in most modern browsers.
c. AAC: While generally well-supported, AAC files can have issues in some older browsers.
d. Sample Rate: The files use a 48kHz sample rate. While this is good for quality, ensure all target browsers and devices can handle this rate. Some older or low-end devices might struggle with high sample rates.
e. File Size: With 15-minute tracks, file sizes could be large. Consider offering lower bitrate versions for users with slower connections.
f. Codec Support: Different browsers have varying levels of codec support. It might be beneficial to provide multiple format options for each track to ensure the widest possible compatibility.
5.
Future-proofing:
Consider adding a version number or date to the file paths to facilitate future updates without breaking existing links.
Implement a fallback system where if a preferred format isn't supported, the application can automatically switch to an alternative.
7.
Accessibility: Ensure that text alternatives or transcripts are available for audio content to comply with web accessibility standards.
*
*
*/