Soil and aquatic multicellular microorganisms play a critical role in the nutrient-cycling and organismal ecology of soil and aquatic ecosystems. These organisms live and behave in a complex three-dimensional environment. Most studies of microorganismal behavior, in contrast, have been conducted using microscope-based approaches, which limit the movement and behavior to a narrow, nearly two-dimensional focal field. We report on a novel analytical approach that provides real-time analysis of freely swimming C. elegans without dependence on microscope-based equipment. This approach consists of tracking the temporal periodicity of diffraction patterns generated by directing laser light onto nematodes in a cuvette. We measured oscillation frequencies for freely swimming nematodes in cuvettes of different sizes to provide different physical constraints on their swimming. We compared these frequencies with those obtained for nematodes swimming within a small droplet of water on a microscope slide, a strategy used by microscope-based locomotion analysis systems. We collected data from diffraction patterns using two methods: video analysis and real time data acquisition using a fast photodiode. Swimming frequencies of nematodes in a droplet of ionic solution on a microscope slide was confirmed to be 2.00 Hz with a variance of 0.05 Hz for the video analysis method and 0.03 Hz for the real time data acquisition using a photodiode; this result agrees with previously published estimates using microscope-based analytical techniques. We find the swimming frequency of unconstrained worms within larger cuvettes to be 2.37 Hz with a variance of 0.02 Hz. As the cuvette size decreased, so did the oscillation frequency, indicating a change in locomotion when physical constraints are introduced.