stringing together N163 waves? - FamiTracker

# FamiTracker

FamiTracker Support Forums

Skip to content

## stringing together N163 waves?

General discussion about tracking, help and support.
Post Reply

- Print view

6 posts • Page 1 of 1

beachbum811
  Posts: 104
  Joined: Thu Jul 28, 2016 2:19 pm

### stringing together N163 waves?

- Quote

Post by beachbum811 » Wed Aug 10, 2016 1:26 am

I can make an N163 instrument such that there are 16 waves: (for simplicity let's make the wave size 4)
wave 00: "00 00 01 01"
wave 01: "02 02 03 03"
wave 02: "04 04 05 05"
wave 03: "06 06 07 07"
wave 04: "08 08 09 09"
wave 05: "10 10 11 11"
wave 06: "12 12 13 13"
wave 07: "14 14 15 15"
wave 08: "15 15 14 14"
wave 09: "13 13 12 12"
wave 10: "11 11 10 10"
wave 11: "09 09 08 08"
wave 12: "07 07 06 06"
wave 13: "05 05 04 04"
wave 14: "03 03 02 02"
wave 15: "01 01 00 00"
Every wave by itself is a really quiet square wave, but if there is
a wave envelope like this: "| 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15"
the channel could, in theory, play a triangle wave.
With longer wave sizes, (the max in famitracker 0.5 is 240) I could make an instrument with a wave size of up to 3,840!
(of course I would use that wave size for something more complex than a triangle wave.)
Or I could not have it loop and use it like the DPCM channel!
If there is a way to string together N163 waves in this fashion, then how is it done?
Last edited by beachbum811 on Wed Aug 10, 2016 1:31 am, edited 2 times in total.
Top

beachbum811
  Posts: 104
  Joined: Thu Jul 28, 2016 2:19 pm

### Re: stringing together N163 waves?

- Quote

Post by beachbum811 » Wed Aug 10, 2016 1:29 am

I can make an N163 instrument such that there are 16 waves: (for simplicity let's make the wave size 4)
wave 00: "00 00 01 01"
wave 01: "02 02 03 03"
wave 02: "04 04 05 05"
wave 03: "06 06 07 07"
wave 04: "08 08 09 09"
wave 05: "10 10 11 11"
wave 06: "12 12 13 13"
wave 07: "14 14 15 15"
wave 08: "15 15 14 14"
wave 09: "13 13 12 12"
wave 10: "11 11 10 10"
wave 11: "09 09 08 08"
wave 12: "07 07 06 06"
wave 13: "05 05 04 04"
wave 14: "03 03 02 02"
wave 15: "01 01 00 00"
Every wave by itself is a really quiet square wave, but if there is
a wave envelope like this: "| 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15"
the channel could, in theory, play a triangle wave.
With longer wave sizes, (the max in famitracker 5.0 is 240) I could make an instrument with a wave size of up to 3,840!
(of course I would use that wave size for something more complex than a triangle wave.)
Or I could not have it loop and use it like the DPCM channel!
If there is a way to string together N163 waves in this fashion, then how is it done?
Top

Quirby64
  Posts: 77
  Joined: Sun Jan 03, 2016 3:32 am
  Location: United States
  Contact:
  Contact Quirby64
  Skype Google+

### Re: stringing together N163 waves?

- Quote

Post by Quirby64 » Wed Aug 10, 2016 3:06 am

The wave setting in the edit instrument window, or to use VXX and Speed 1.
Honestly, though, I dunno if it can switch waves fast enough to do what your attempting. /.-./
Dank Memes. That's all I got.
Top

HertzDevil
  Posts: 475
  Joined: Thu Apr 23, 2015 7:39 pm
  Location: Hong Kong SAR
  Contact:
  Contact HertzDevil
  Website Facebook Twitter Skype
  YouTube

### Re: stringing together N163 waves?

- Quote

Post by HertzDevil » Wed Aug 10, 2016 3:40 am

A few criteria:

1. The instrument must be played at exactly the refresh rate of the module;
2. The instrument must reset the channel phase to 0 every time it is triggered;
3. If the instrument loops, the length of the sample must fit exact ticks.

Because there is always a slight error between your refresh rate and the closest value the N163 frequency registers can attain, eventually the instrument will start from a different wave position on each tick, so the phase reset is required for these waves to play properly over a long time; CChannelHandlerN163::m_bResetPhase performs this on new notes, but is presumably commented out since controlling such a setting from the channel handler could affect the sound of all N163 instruments.
For preparing unlooped waveforms quickly, I would write a Lua script: using any audio editor, save your sample as raw, unsigned 8-bit mono PCM, resampled to (refresh rate × N163 wave size) Hz, then pass it to raw2fti.lua below (not going to make it read WAV headers). Attached is an example of running this script on a 8 kHz PCM clip, at 40 Hz refresh rate and a wave size of 200. You need to manually adjust your instrument's pitch sequence afterwards to get the intended output. Instruments like this are clearly not supposed to be used in exported NSFs, only short percussion samples will do (even then it still requires a mechanism to reset the N163 channel phase).
For looped waveforms, it is very unlikely they will meet the third criterion, but using this sampler (also in Lua) they can be played at any frequency.

Attachments
  raw2fti.txt
    renamed to .txt because the forum does not accept .lua files
    (1.42 KiB) Downloaded 156 times
  bea.050.ftm
    Requires FamiTracker 0.5.0 beta 5, or 0CC-FamiTracker 0.3.14.3 or above
    (96.83 KiB) Downloaded 187 times

refactoring 0cc-famitracker
Top

beachbum811
  Posts: 104
  Joined: Thu Jul 28, 2016 2:19 pm

### Re: stringing together N163 waves?

- Quote

Post by beachbum811 » Sat Aug 13, 2016 2:00 pm

Thank you for your genius.
(I took so ling to respond because I was taking so long trying to get it to work)
Hello World!
Behold as I run facefirst into the endless abyss of hate that is the internet!
I do Musescore and Scratch with the same username!
OH and I also use beta 0.5 so...
Top

beachbum811
  Posts: 104
  Joined: Thu Jul 28, 2016 2:19 pm

### Re: stringing together N163 waves?

- Quote

Post by beachbum811 » Thu Aug 18, 2016 9:29 pm

I asked on the original post (viewtopic.php?f=4&t=1147) but received no reply.
I thought I would have better luck here.
It's not coming out right.
This is the .wav sample:

wave.txt
  The site won't let me upload .wav files, change back the extention after downloading
  (30.59 KiB) Downloaded 136 times

This is what I typed into cmd.
lua wavegen.lua wave.wav 16 10 16
This is the resulting fti:

wut.ftm
  I put it in an ftm for simplicity
  (1.07 KiB) Downloaded 151 times

What am I doing wrong?
Hello World!
Behold as I run facefirst into the endless abyss of hate that is the internet!
I do Musescore and Scratch with the same username!
OH and I also use beta 0.5 so...
Top

Display posts from previous:
Sort by

Post Reply

- Print view

6 posts • Page 1 of 1

Return to “General Talk”

Jump to

- Rules
- Wiki
- FamiTracker
- General Talk
- Bug Reports
- Feature Requests
- Source and development
- Music
- Original Music
- Cover Music
- Other
- Site Issues & Suggestions