Hello Malda,
Generally, a speaker that has a power connector (and often a volume knob) contains an audio amplifier circuit. An earlier generation of training rigs at CSHL used this one (now discontinued):
https://i.ebayimg.com/images/g/mTEAAOSwm3RilgMy/s-l1600.jpg[/img]
If ultra-high fidelity ultrasonic reproduction matters, I'd consider Avisoft's amp and speaker. TDT also has a good option.
You can get acceptable ultrasonic performance for most applications via a DIY route: This speaker + this amplifier + this power supply. You'll need to solder some speaker wire to the speaker, and you'll need a 3.5mm audio cable. You'll also need to figure out how to mount the speaker in your rig. As with any DIY option, definitely validate the setup with a measurement instrument (ultrasonic mic) to make sure it's doing what you expect before you start experiments.
If you just need distinguishable audio cues (i.e. if the character of the sound is unimportant for your analysis beyond separate cues being distinguishable to the test subject), you can use a set of consumer grade computer speakers similar to the ones pictured above.
The Bpod HiFi module is controlled from MATLAB via this class in the Bpod_Gen2 repository. Once you've created an instance of the class with
H = BpodHiFi('COM3'); % Where COM3 is the HiFi module's USB serial port
you can adjust the volume with:
H.DigitalAttenuation_dB = N; % Where N is attenuation in dBFS. 0 = Full volume. Values are negative, and can range to -120.
Waveforms can be rendered in MATLAB as vectors with values ranging between -1 and 1. Bpod includes some convenience functions for generating waveforms. Waveforms are sent to the HiFi module with:
H.load(X, Waveform); % Where X is the index of the waveform
Once loaded to the device, the waveform can be triggered from any state by setting its output actions (also see this):
{'HiFi1', ['P' Z]} % Where Z is waveform index. Note that Arduino indexes by 0, so waveform 3 is known as 2 on the Arduino side.
The HiFi module can generate its own pure tones and white noise waveforms using 'Synth' functions. Setup from MATLAB is documented here, control from the state machine is documented here, and an example 2AFC protocol using synth is given here.
-Josh