I want to dinamically modify the sound generator registers to create music or a sound effect. Should I do that in the vbi() method?
No. The IAVC simulation does its best to redraw the screen 25 times per second and it manages to do it well enough for a video game animation, but it is not accurate enough for audio. The sound generator hardware (simulation) synthetizes audio in Sound Frames, at a rate of 25 sound frames per second. After each sound frame it generates a Sound Frame Interrupt (SFI). You can have your code executed at that time by placing it in a method named sfi().