Audio From Scratch With Go: Changing the amplitude
Jul 18, 2020
In the previous post we have written code to read and write WAVE files. So now it’s time to start using this functionality to actually manipulate some sound. The goal of this post is simple, we want to change the amplitude of a given .wave file.
For this, I will import the library we wrote in Part 2.
The code for this post is also on Github.
Changing amplitudes The program to change the amplitude will require three inputs:
...
➦
Audio From Scratch With Go: Anatomy of a wave (file)
Jul 13, 2020
In our last post we have looked at how we can create a simple binary sound file. By creating a sine wave with exponential decay, we can get the effect of a single note playing.
It’s good to know what these types of files look like. In the real world however you’ll usually encounter files that are a bit more complex. One of the common formats to find audio in is the WAVE file format, normally denoted with the extension .
...
➦
Audio From Scratch With Go: Generating first sounds
Jul 13, 2020
Audio from scratch: generating sound In my ‘audio from scratch’ series we will take a look at various ways in which we can manipulate audio data with Go. We’ll look at the anatomy of a wave file, how to apply stereo panning, converting mono files to stereo, how to work with breakpoint files through linear interpolation, etc.
But, in this post we’ll be using Go to create sound from scratch in binary format.
...
➦
Hasgo: how does it work?
May 25, 2019
What is Hasgo? Hasgo is a code generator that can be used to generate functions that work on slices. We don’t have generics in Go, which I think is a good thing, but we can generate code with go:generate to work on different types.
Hasgo does just this, we write functions and then say for which types we want to generate these functions. For our Ints, the generation looks like this:
...
➦
go set benchmark
Apr 15, 2019
Go does not have a set datastructure. A common pattern is to mimick a set by using a map where the key is the “set entry” and the value does not matter.
In a discussion on hackernews recently, we discussed two similar implementations for a set, namely:
map[type]bool map[type]struct{} They are almost identical, and whilst I really like the first definition it was brought to my attention that the second might be favourable for performance reasons.
...
➦
Psychology of Computer Programming
Mar 27, 2019
Recently I have read The Psychology of Computer Programming, written by Gerald M. Weinberg. The book was originally published in 1971, though it got republished in 2011. (I read it on a kindle paperwhite and it looked great! So don’t worry about the age of the book in case you fear it won’t look good in e-book format).
Even though the book was written in a time before the public internet, Java, Javascript, smartphones and many more things we take for granted today, a lot of the content still rings true today.
...
➦
Version 2.0 of my blog :)
Mar 22, 2019
The past After two years of not having written anything for my blog, I’ve decided it was time to start anew.
My old blog was created using WordPress in mid-2011, it was the first blog that was hosted on a machine a friend and I rented rather than blogspot. Whilst the blog served it’s purpose and was home to 7 years of content-creation, I felt like it was time to change things up.
...
➦