Rockbox.org home
Downloads
Release release
Dev builds dev builds
Extras extras
themes themes
Documentation
Manual manual
Wiki wiki
Device Status device status
Support
Forums forums
Mailing lists mailing lists
IRC IRC
Development
Bugs bugs
Patches patches
Dev Guide dev guide
Search



Donate

Rockbox Technical Forums


Login with username, password and session length
Home Help Search Staff List Login Register
News:

Rockbox Ports are now being developed for various digital audio players!

+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Plugins/Viewers
| | |-+  Sound/DSP from within plugins?
« previous next »
  • Print
Pages: [1]

Author Topic: Sound/DSP from within plugins?  (Read 5490 times)

Offline Adion

  • Member
  • *
  • Posts: 8
    • My Website
Sound/DSP from within plugins?
« on: August 24, 2006, 01:27:46 PM »
Does anyone know if it's possible to play sound from within a plugin while music is playing, or if it is possible to alter the sound that is currently playing?

One of the things that I want to do with it is add a function to the stopwatch plugin to have it play a sound at regular intervals so that you don't have to look at the screen while jogging for example.
Other things that I can think of that may be interesting is that it would be easy of any kind of dsp functions could be done by creating a plugin that can alter the sound. (Compressors, equalizers, ... could all be written as plugins then)

It would be great if a plugin could get a callback from the audio system on each buffer to do this, but I haven't searched into the rockbox core yet to find out if this is possible, and if this could work for on all targets.
Maybe some developer with a bit more rockbox experience could point me in the right direction?
Logged

Offline Adion

  • Member
  • *
  • Posts: 8
    • My Website
Re: Sound/DSP from within plugins?
« Reply #1 on: August 24, 2006, 03:50:11 PM »
Ok, I have been looking into this a bit more, and I managed to create a first test plugin that alters the sound :)

To do this, I added a function pointer to dsp.c:
Code: [Select]
static void (*dsp_external)(int32_t* src[], int count);
And I made dsp_process use this function if it is not NULL.
I also added a function to edit this pointer to dsp.h, and I then added this edit function to the plugin structure.
Finally I initialized the dsp callback function at the start of the plugin, and set it back to NULL when the plugin was finished.

For now I just tested a plugin that lowers the volume as a test, and this works, although there is a delay of a few seconds it seems between starting the plugin and hearing the volume drop (which is probably not that much of a problem for most plugins)

My suggestion if more people think this kind of functionality would be useful is to create an array of dsp function pointers, along with a function to add and remove dsp functions from that array.
That way you could even enable multiple sound plugins, and the current dsp functions (equalizer and crossfeed) could also be added by default to the same array.
Logged

Offline xlarge

  • Member
  • *
  • Posts: 191
Re: Sound/DSP from within plugins?
« Reply #2 on: August 25, 2006, 06:00:05 AM »
Glorious!

I'm thinking normalizing compressor/limiter. All tracks at the same percepted volume.
Logged

Offline Llorean

  • Member
  • *
  • Posts: 12931
Re: Sound/DSP from within plugins?
« Reply #3 on: August 25, 2006, 06:05:17 AM »
Replaygain already pretty much does that... And since it's precalculated it'll be more battery efficient than trying to do it during playback.
Logged

Offline xlarge

  • Member
  • *
  • Posts: 191
Re: Sound/DSP from within plugins?
« Reply #4 on: August 25, 2006, 06:22:56 AM »
Quote from: Llorean on August 25, 2006, 06:05:17 AM
Replaygain already pretty much does that... And since it's precalculated it'll be more battery efficient than trying to do it during playback.

If i get my tracks tagged for it - true.
Logged

Offline Llorean

  • Member
  • *
  • Posts: 12931
Re: Sound/DSP from within plugins?
« Reply #5 on: August 25, 2006, 06:25:17 AM »
Well, considering the speed of the processors on the players, you're going to get *much* better results pre-tagging for replaygain than attempting to do something similar realtime.
Logged

Offline xlarge

  • Member
  • *
  • Posts: 191
Re: Sound/DSP from within plugins?
« Reply #6 on: August 25, 2006, 06:39:18 AM »
If you say so sir.
Logged

Offline Adion

  • Member
  • *
  • Posts: 8
    • My Website
Re: Sound/DSP from within plugins?
« Reply #7 on: August 25, 2006, 09:30:42 AM »
There was a user (not sure if I read it on the forums or in the feature requests) that wanted a normalizer/compressor in real-time so that silent parts would get played louder for listening in a car for example.
Replaygain is very suited for volume differences between songs, but not for volume differences within a song.

Anyway I'm now working on my stopwatch update that will play beeps at regular intervals, and when you press a button, and it's beginning to work quite nice.
Logged

Offline mborus

  • Member
  • *
  • Posts: 127
Re: Sound/DSP from within plugins?
« Reply #8 on: October 11, 2006, 11:06:51 AM »
Code: [Select]
There was a user (not sure if I read it on the forums or in the feature requests) that
wanted a normalizer/compressor in real-time so that silent parts would get played louder for
listening in a car for example.

Replaygain is very suited for volume differences between songs, but not for volume
differences within a song.

This is a very late comment, but just to get the discussion going again:

A compressor might not be that useful for music, but it's essential, if you
want to play back recordings of lectures or other live recordings in a
noisy environment.

The original Archos jukeboxes have a hardware gain control.
There's a setting that adjusts the volume every 20ms (or so)

A fast reaction time like this ensures that the lecturer can be heard
clearly, but that coughs or other load audience noises don't damage your
speakers and/or hearing.

Logged

  • Print
Pages: [1]
« previous next »
+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Plugins/Viewers
| | |-+  Sound/DSP from within plugins?
 

  • SMF 2.0.17 | SMF © 2019, Simple Machines
  • Rockbox Privacy Policy
  • XHTML
  • RSS
  • WAP2

Page created in 0.085 seconds with 15 queries.