Audio Mode

The most versatile and user friendly E-Stim control unit available today. If you want More Power, More Control, and more fun, then the 2B is the one you want.
Post Reply
SklaveDaniel
Active
Posts: 9
Joined: Fri Apr 28, 2017 10:07 pm
Location: Lübeck

Audio Mode

Post by SklaveDaniel »

I am trying to write an App to controle the 2b box. I know the existing software but I wanted to experiment with some stuff.
Also I thought about controlling the output via generated audio instead of the USB protocol as I have the impression it would give me a finer level of control and more flexiblity in influencing the output signals.
Is there any information on how the audio mode works?
Is it reasonable to controll it using a single sinus signal (with varying frequency and amplitude)?
Or does it make sense to mix several frequencies to make get an output that I could not get with a single frequency?

I know I have to experement, but what I am asking for is the parameters I should experement with.
Also is it in theory possible to get the outputs generated by the other modes just be providing a suitable audio input?


User avatar
admin
Site Admin
Posts: 2100
Joined: Tue Feb 19, 2008 8:14 pm
Location: Watford,UK
Contact:

Re: Audio Mode

Post by admin »

In theory its possible, but since the audio mode was designed to process the incoming signal to generate a feelable output over a range of frequencies, you are going to have some unpredictability issues. The signals are not random, but for instance a doubling of frequency or amplitude will not result in a doubling of the output, especially as the human bodies response is generally more logarithmic.


Si
E-Stim Systems Ltd
birdburdy
Active Developer
Posts: 162
Joined: Mon Aug 11, 2008 6:58 pm

Re: Audio Mode

Post by birdburdy »

Mixing audio signals doesn't work that well in my experience, it tends to go off the end the frequency range and result in no stimulation.

In Linux, you can use the speakertest command line program to generate different audio signals, that's quite interesting.

In any platform you can use audacity to generate sounds in a similar way.
Unofficial Python API for the E-Stim 2B: https://github.com/fredhatt/estim2bapi
Generating sounds in Python: https://github.com/fredhatt/estimsoundsynth
SklaveDaniel
Active
Posts: 9
Joined: Fri Apr 28, 2017 10:07 pm
Location: Lübeck

Re: Audio Mode

Post by SklaveDaniel »

@admin
I don't think it will be a problem that it is not physically linear. It would be more usefull to be "perception linear" anyway, so that twice the frequency feels twice as strong, whatever that means for the physical output.
My main questions is: do I get all the variation I can get using a single sinus wave and varying amplitude and frequency. Or do I have to do more?

@birdburdy
I will synthesize the signal myself. That is quite easy to do, just sampling a sinus appropriately and writing that to some audio device.
birdburdy
Active Developer
Posts: 162
Joined: Mon Aug 11, 2008 6:58 pm

Re: Audio Mode

Post by birdburdy »

SklaveDaniel wrote: I will synthesize the signal myself. That is quite easy to do, just sampling a sinus appropriately and writing that to some audio device.
Cool, can I ask what language/libraries you'll use to do that? I have been wanting to make my own audio for a while (and would love to do it on the fly).

Also, a square wave feels quite different to a sine wave, and I imagine sawtooth waves feel different again.
Unofficial Python API for the E-Stim 2B: https://github.com/fredhatt/estim2bapi
Generating sounds in Python: https://github.com/fredhatt/estimsoundsynth
SklaveDaniel
Active
Posts: 9
Joined: Fri Apr 28, 2017 10:07 pm
Location: Lübeck

Re: Audio Mode

Post by SklaveDaniel »

Well, I want to do it on Android, as I want to use a mobile phone. I am using Scala (so basically the Java Android API).
But it should work more or less the same on Desktop Java.
Basically, the API gives you some sink that you can write a floating point numbers to indicating the output level of an audio channel with a certain sampling rate.
I'll put the code somewhere once I have something working.
SklaveDaniel
Active
Posts: 9
Joined: Fri Apr 28, 2017 10:07 pm
Location: Lübeck

Re: Audio Mode

Post by SklaveDaniel »

After experimenting a bit, I have an other question:
Are the channels intended to be completely separated? [...]

Ok, by now I can aswer that myself: the 2B is not detected as a head phone by android but as some line out sink or something.
And appearently at least my phone generates a signal that is too weak for the box or does something else that is strange.
Running the app on a emulator on my laptop works fine, so does streaming the sound from the phone over bluetooth to the laptop and then to the box.
So I guess I will get a small bluetooth receiver to plug into the box, that will result in a more convenient setup anyway.
Would be interessting however, if this is a problem with my phone or a general problem with smartphones.

Btw: here is a first prove of concept app: https://gitlab.com/SklaveDaniel/ElectricCommander
For now it allows to generate sinus waves at adjustable frequency and volume for each stereo channel.
You''ll also find the source code there.
Post Reply