Difference between revisions of "Audio Player"

From ZynthianWiki
Jump to navigation Jump to search
(Adds screenshot)
 
(8 intermediate revisions by one other user not shown)
Line 17: Line 17:
 
The information shown in the control view can be switched with the "info" control between: None, file duration, play position, remaining playback time, length of loop, samplerate of file, file audio encoding (CODEC) or filename.
 
The information shown in the control view can be switched with the "info" control between: None, file duration, play position, remaining playback time, length of loop, samplerate of file, file audio encoding (CODEC) or filename.
  
'''''Not yet implemented:''' By double tapping the screen, cue point markers can be added. These can be used to identify points of interest in the file and playhead position can be shifted between these points with the "play cue" controller. These markers can be selected with the "cue point" control and dragged or moved with the "cue pos" control.''
+
By double tapping the screen, markers can be modified. This includes setting the crop and loop markers to the position tapped and adding and removing cue point markers. Cue point markers can be used to identify points of interest in the file and __playhead position can be shifted between these points with the "play cue" controller (not yet implemented)__. These markers can be selected with the "cue point" control and moved with the "cue pos" control or dragged on a touchscreen.
  
'''''Not yet implemented:''' A control allows the audio to be played forwards and backwards at the speed of the control to give a scrub or record scratch effect. Another control adjusts playback speed like a tape machine varispeed with pitch and speed changing in unison. (Maybe varispeed, reverse and scrub use the same control?)''
+
Playback speed and pitch can be adjusted separately and there is also a ''varispeed'' control which adjusts playback speed and pitch like a tape machine. Varispeed can be set zero to pause playback and to a negative value to play backwards. This can be used to ''scrub'' the audio.
  
 
These controls allows manipulation of the playback and most can be used in other modes described below.
 
These controls allows manipulation of the playback and most can be used in other modes described below.
  
 
=== MIDI Sample Player ===
 
=== MIDI Sample Player ===
Audio Player will act as a MIDI controlled sample player. A MIDI note-on will start playback which will continue until MIDI note-off is received. The root note is middle C4 (MIDI note 60). Other notes will playback at the associated pitch change, e.g. C5 (MIDI note 72) will play at double pitch. Playback speed remains constant, i.e. the duration would be the same, only the pitch shifted. MIDI sustain pedal will sustain playback after the key is released. This controls the "sustain pedal" control that can also be manually set to sustain playback. MIDI Pitchbend will change the pitch by up to +/- 2 semitones by default. This range can be adjusted with the "bend range" control up to +/- 24 semitones (2 octaves) with a minimum value of 0 (pitchbend disabled).
+
Audio Player will act as a MIDI controlled sample player. A MIDI note-on will start playback which will continue until MIDI note-off is received. The default root note is middle C4 (MIDI note 60) but this can be changed. Other notes will playback at the associated pitch change, e.g. C5 (MIDI note 72) will play at double pitch. Playback speed remains constant, i.e. the duration would be the same, only the pitch shifted. MIDI sustain pedal will sustain playback after the key is released. This controls the "sustain pedal" control that can also be manually set to sustain playback. MIDI Pitchbend will change the pitch by up to +/- 2 semitones by default. This range can be adjusted with the "bend range" control up to +/- 24 semitones (2 octaves) with a minimum value of 0 (pitchbend disabled).
  
 
There is an ADSR amplitude envelope that affects MIDI note-on/off triggered playback. A non-zero release time will cause playback to continue after note-off.
 
There is an ADSR amplitude envelope that affects MIDI note-on/off triggered playback. A non-zero release time will cause playback to continue after note-off.
  
Playback is monophonic, i.e. only one playback will occur at any time. Legato is implemented, i.e. pressing a new note before releasing the previous will not restart playback or the ADSR envelope whereas releasing a note then pressing the next will restart playback from the start of the file (or crop marker) and restart the ADSR envelope. An exception is playing the same note without sending note-off will restart. (This is not normally ypossible from a single keyboard.)
+
Playback is monophonic, i.e. only one playback will occur at any time. Legato is implemented, i.e. pressing a new note before releasing the previous will not restart playback or the ADSR envelope whereas releasing a note then pressing the next will restart playback from the start of the file (or crop marker) and restart the ADSR envelope. An exception is playing the same note without sending note-off will restart. (This is not normally possible from a single keyboard.)
  
=== Beats In File ===
+
=== Tempo Playback ===
 
There is a control called, "beats" which allows the user to specify the quantity of beats in the audio file (between the crop markers). If this is non-zero then the file will playback at a rate that matches the beats to Zynthian's global tempo, e.g. if the file is set to 4 beats and the tempo is set to 120BPM then the file duration will be adjusted to 2s. The pitch is not changed. This allows an audio clip to be played in sync with Zynthian's sequencer and MIDI player. There is integration with ZynPad to allow a pad to control audio player in this way.
 
There is a control called, "beats" which allows the user to specify the quantity of beats in the audio file (between the crop markers). If this is non-zero then the file will playback at a rate that matches the beats to Zynthian's global tempo, e.g. if the file is set to 4 beats and the tempo is set to 120BPM then the file duration will be adjusted to 2s. The pitch is not changed. This allows an audio clip to be played in sync with Zynthian's sequencer and MIDI player. There is integration with ZynPad to allow a pad to control audio player in this way.
  
 
=== Splicer ===
 
=== Splicer ===
  
'''''Not yet implemented:''' As described above, it is possible to add cue point markers. If there are any cue point markers defined then MIDI playback behaviour changes. Instead of MIDI notes playing back at different pitch, the segments of audio between the markers are treated as separate notes. Middle C4 (MIDI note 60) will play the first segment, C#4 the second segment, etc. Playback is monophonic, i.e. only one segment will play at a time. Each segment responds with the (global) ADSR amplitude envelope.''
+
As described above, it is possible to add cue point markers. If there are any cue point markers defined then MIDI playback behaviour changes. Instead of MIDI notes playing back at different pitch, the segments of audio between the markers are treated as separate notes. The ''root note'' will play the first segment, C#4 the second segment, etc. Playback is monophonic, i.e. only one segment will play at a time. Each segment responds with the (global) ADSR amplitude envelope. Other pitch adjustments will still operate, e.g. pitchbend, varispeed, etc.
 +
 
 +
=== Files ===
 +
 
 +
Audio Player can load and save files using Zynthian's ''presets'' mechanism. Files are stored in the ''capture'' directory on the internal storage and on any USB attached storage. These different volumes appear as ''Banks'' in the presets mechanism. The following file formats (CODECS) can be loaded:
 +
 
 +
* WAV (all bit depths)
 +
* FLAC
 +
* OGG (/VORBIS)
 +
* MP3 (MPEG I/II, layer 3)
 +
* AAC
 +
* AIFF
 +
* AIFC
 +
* AU
 +
* CAF
 +
* VOX
 +
* OPUS
 +
 
 +
Note: The CODEC appreviations listed above are used as the filename extension when searching for audio files.
 +
 
 +
Any samplerate can be loaded and the audio is converted to Zynthian's native samplerate. Files are always saved as 32-bit float WAV at Zynthian's naitive samplerate.
 +
 
 +
Zynthian reads and writes various metadata including:
 +
 
 +
* Cue markers (used for splicing)
 +
* Quantity of beats in sample (used for tempo sync)
 +
* Looping enabled
 +
* Loop start / end markers
 +
* MIDI root key (the note that will trigger playback at naitive pitch)
 +
* Gain (+/-100dB)
 +
 
 +
These parameters modify configuration of Audio Player and are saved into any new files based on the current settings (including global tempo).
 +
 
 +
Be aware that a file may contain some metadata that will configure the Audio Player so check it is behaving as expected after loading a new file. It is recommended to resave files to ensure the expected configuration is stored in its metadata.

Latest revision as of 20:09, 15 August 2024

1 Audio Player

Audio Player

The Zynthian Audio Player is an engine that loads and plays a variety of formats of audio files including WAV, OGG, MP3, FLAC, etc. In its simplest form it plays the loaded file from start to end or until it is paused or stopped but there are many modes it can operate in which are described here.

1.1 Simple File Player

An audio file is loaded by using the Load Preset mechansim. Files in the Zynthian's internal "Capture" directory and any attached USB storage are available. Different storage media are presented as different "Banks" in the preset system. The audio waveform is displayed in the control view and some information is displayed at the bottom. By default this is the audio duration in minutes, seconds and milliseconds. Audio playback can be started, paused and stopped with the transport buttons or with the "transport" control. Playhead position can be adjusted with the "position" control and audio level is adjusted with the "gain" control".

By default the whole audio file is played but a region can be defined with the "crop" controls. These define the start and end of audio to play. The waveform is shaded to indicate this. The display horizontal (time) and vertical (amplitude) zoom levels can be adjusted with controls or pinch zoom gestures. There are some preset zoom ranges which will show the whole file, just the cropped section, just the loop or user manually adjusted. When the display is horizontally zoomed the display position is adjusted with the "view offset" control. This can also be adjusted by dragging the bottom scrollbar horizontally.

The file will play from the start until the end (or stopped / paused) but can be configured to loop by setting the "loop" control to "looping". There are controls to adjust the start and end of the loop. Playback will start from the start of file (or crop start) and play until the loop end marker where it will jump back to the loop start marker. Not yet implemented: Other options are to play the audio in reverse from end to start, play in reverse with loop or play forward then ping-pong loop (reverse then forwards through the loop).

Crop and loop markers can be set by double tapping the screen and can also be dragged. Note: The loop markers will be moved when reducing playback duration with crop but will not be changed when increasing the crop duration.

Audio files are commonly stereo and each channel will play out of the Audio Players left and right outputs as expected. Mono files will play out of both and multitrack files can have each track selected with the "left track" and "right track" controls. Each Audio Player output can be fed from any channel in the audio file or a mix of alternate tracks.

The information shown in the control view can be switched with the "info" control between: None, file duration, play position, remaining playback time, length of loop, samplerate of file, file audio encoding (CODEC) or filename.

By double tapping the screen, markers can be modified. This includes setting the crop and loop markers to the position tapped and adding and removing cue point markers. Cue point markers can be used to identify points of interest in the file and __playhead position can be shifted between these points with the "play cue" controller (not yet implemented)__. These markers can be selected with the "cue point" control and moved with the "cue pos" control or dragged on a touchscreen.

Playback speed and pitch can be adjusted separately and there is also a varispeed control which adjusts playback speed and pitch like a tape machine. Varispeed can be set zero to pause playback and to a negative value to play backwards. This can be used to scrub the audio.

These controls allows manipulation of the playback and most can be used in other modes described below.

1.2 MIDI Sample Player

Audio Player will act as a MIDI controlled sample player. A MIDI note-on will start playback which will continue until MIDI note-off is received. The default root note is middle C4 (MIDI note 60) but this can be changed. Other notes will playback at the associated pitch change, e.g. C5 (MIDI note 72) will play at double pitch. Playback speed remains constant, i.e. the duration would be the same, only the pitch shifted. MIDI sustain pedal will sustain playback after the key is released. This controls the "sustain pedal" control that can also be manually set to sustain playback. MIDI Pitchbend will change the pitch by up to +/- 2 semitones by default. This range can be adjusted with the "bend range" control up to +/- 24 semitones (2 octaves) with a minimum value of 0 (pitchbend disabled).

There is an ADSR amplitude envelope that affects MIDI note-on/off triggered playback. A non-zero release time will cause playback to continue after note-off.

Playback is monophonic, i.e. only one playback will occur at any time. Legato is implemented, i.e. pressing a new note before releasing the previous will not restart playback or the ADSR envelope whereas releasing a note then pressing the next will restart playback from the start of the file (or crop marker) and restart the ADSR envelope. An exception is playing the same note without sending note-off will restart. (This is not normally possible from a single keyboard.)

1.3 Tempo Playback

There is a control called, "beats" which allows the user to specify the quantity of beats in the audio file (between the crop markers). If this is non-zero then the file will playback at a rate that matches the beats to Zynthian's global tempo, e.g. if the file is set to 4 beats and the tempo is set to 120BPM then the file duration will be adjusted to 2s. The pitch is not changed. This allows an audio clip to be played in sync with Zynthian's sequencer and MIDI player. There is integration with ZynPad to allow a pad to control audio player in this way.

1.4 Splicer

As described above, it is possible to add cue point markers. If there are any cue point markers defined then MIDI playback behaviour changes. Instead of MIDI notes playing back at different pitch, the segments of audio between the markers are treated as separate notes. The root note will play the first segment, C#4 the second segment, etc. Playback is monophonic, i.e. only one segment will play at a time. Each segment responds with the (global) ADSR amplitude envelope. Other pitch adjustments will still operate, e.g. pitchbend, varispeed, etc.

1.5 Files

Audio Player can load and save files using Zynthian's presets mechanism. Files are stored in the capture directory on the internal storage and on any USB attached storage. These different volumes appear as Banks in the presets mechanism. The following file formats (CODECS) can be loaded:

  • WAV (all bit depths)
  • FLAC
  • OGG (/VORBIS)
  • MP3 (MPEG I/II, layer 3)
  • AAC
  • AIFF
  • AIFC
  • AU
  • CAF
  • VOX
  • OPUS

Note: The CODEC appreviations listed above are used as the filename extension when searching for audio files.

Any samplerate can be loaded and the audio is converted to Zynthian's native samplerate. Files are always saved as 32-bit float WAV at Zynthian's naitive samplerate.

Zynthian reads and writes various metadata including:

  • Cue markers (used for splicing)
  • Quantity of beats in sample (used for tempo sync)
  • Looping enabled
  • Loop start / end markers
  • MIDI root key (the note that will trigger playback at naitive pitch)
  • Gain (+/-100dB)

These parameters modify configuration of Audio Player and are saved into any new files based on the current settings (including global tempo).

Be aware that a file may contain some metadata that will configure the Audio Player so check it is behaving as expected after loading a new file. It is recommended to resave files to ensure the expected configuration is stored in its metadata.