2017-07-07 12:44:34 +02:00
|
|
|
// Auto-generated. Do not edit.
|
|
|
|
declare namespace music {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the output volume of the sound synthesizer.
|
2018-01-17 02:05:57 +01:00
|
|
|
* @param volume the volume 0...100, eg: 50
|
2017-07-07 12:44:34 +02:00
|
|
|
*/
|
|
|
|
//% weight=96
|
|
|
|
//% blockId=synth_set_volume block="set volume %volume"
|
|
|
|
//% parts="speaker" blockGap=8
|
2018-01-17 02:05:57 +01:00
|
|
|
//% volume.min=0 volume.max=100
|
2017-07-07 12:44:34 +02:00
|
|
|
//% help=music/set-volume
|
|
|
|
//% weight=1 shim=music::setVolume
|
|
|
|
function setVolume(volume: int32): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Play a tone through the speaker for some amount of time.
|
|
|
|
* @param frequency pitch of the tone to play in Hertz (Hz)
|
|
|
|
* @param ms tone duration in milliseconds (ms)
|
|
|
|
*/
|
2017-10-03 08:28:44 +02:00
|
|
|
//% help=music/play-tone
|
2017-07-07 12:44:34 +02:00
|
|
|
//% blockId=music_play_note block="play tone|at %note=device_note|for %duration=device_beat"
|
2017-10-03 08:28:44 +02:00
|
|
|
//% parts="headphone" async
|
|
|
|
//% blockNamespace=music
|
|
|
|
//% weight=76 blockGap=8 shim=music::playTone
|
2017-07-07 12:44:34 +02:00
|
|
|
function playTone(frequency: int32, ms: int32): void;
|
2017-10-30 18:25:58 +01:00
|
|
|
|
2017-12-14 01:31:42 +01:00
|
|
|
/**
|
|
|
|
* Play a tone through the speaker for some amount of time.
|
|
|
|
*/
|
2017-12-15 20:04:16 +01:00
|
|
|
//% help=music/stop-all-sounds
|
|
|
|
//% blockId=music_stop_all_sounds block="stop all sounds"
|
2017-12-14 18:17:47 +01:00
|
|
|
//% parts="headphone"
|
2017-12-14 01:31:42 +01:00
|
|
|
//% blockNamespace=music
|
2018-01-03 23:00:08 +01:00
|
|
|
//% weight=97 shim=music::stopAllSounds
|
2017-12-15 20:04:16 +01:00
|
|
|
function stopAllSounds(): void;
|
2017-12-14 01:31:42 +01:00
|
|
|
|
2017-10-30 18:25:58 +01:00
|
|
|
/** Makes a sound bound to a buffer in WAV format. */
|
|
|
|
//% shim=music::fromWAV
|
|
|
|
function fromWAV(buf: Buffer): Sound;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//% fixedInstances
|
|
|
|
declare interface Sound {
|
|
|
|
/** Returns the underlaying Buffer object. */
|
|
|
|
//% property shim=SoundMethods::buffer
|
|
|
|
buffer: Buffer;
|
|
|
|
|
2017-10-30 19:55:23 +01:00
|
|
|
/** Play sound. */
|
2017-10-30 18:25:58 +01:00
|
|
|
//% promise shim=SoundMethods::play
|
2017-10-30 19:55:23 +01:00
|
|
|
play(): void;
|
2017-07-07 12:44:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Auto-generated. Do not edit. Really.
|