🎧 New Audio Analysis Function: Extract Duration, Sample Rate, Bitrate, and More!

Hi Coda Community! :wave:

I’m excited to share a new function I’ve been working on that makes it easier to analyze audio files directly in your Coda docs. This function extracts key metadata from audio files, such as duration, sample rate, bitrate, number of channels, and more. It also parses file names to extract serial numbers and parts (e.g., β€œA”, β€œB”, etc.).


What It Does

This function accepts either a URL or a file attachment and returns the following details:

  1. Duration: Total duration of the audio file in seconds.
  2. Serial Number: Extracts the serial number from the file name (e.g., 001 from Track_001_A.mp3).
  3. Part: Identifies the source version (e.g., A, B, etc.) from the file name.
  4. Sample Rate: Retrieves the sample rate of the audio file (e.g., 44.1 kHz, 48 kHz).
  5. Bitrate: Retrieves the bitrate of the audio file (e.g., 128 kbps, 320 kbps).
  6. Channels: Retrieves the number of channels (e.g., Mono, Stereo, 5.1 Surround).

1 Like

Are you running this as a headless application, or do the files leave the Coda infrastructure and get processed elsewhere?

β€œCurrently, we are processing files on an external server to speed up the calculation of bitrate, duration, and other metrics. This allows us to deliver faster and more efficient results. When we initially tried running these calculations on Coda, we found it to be slower, so we are actively working on optimizing the speed of these computations. In the future, we plan to enable Coda to handle these calculations directly to improve integration and user experience.”@Gareth_Simpson1